<?php 
require_once "core/initialize.php";
require_once "includes/header.php";
require_once 'functions/changeprofile.php';
//new user
$user = new User();
//$username = $user->data()->username;
//print_r($username);

//get profile field
$userprofile = $user->data()->profile;
$userEmail = $user->data()->email;

if ($user->isLoggedIn()) {

	if (!$user->exists()) {
		Redirect::to(404);
	}else {
		$data = $user->data();
	}
}else {
	Redirect::to('index.php');
}

?>
<div class="section clearing profile">
	<div class="column div_1_of_5">
		<div class="user-info-wrapper">
			<div class="user-avatar-wrapper">	
				<?php 

					if ($userprofile == "") {
						echo "<img src='uploaded/profile/default.png' width='100%' height='190' />";
					}else {
						echo "<img src='uploaded/profile/". $userprofile ."' width='100%' height='190' />";
					}	
				?> 
			</div>

			<div class="user-data-wrapper">
				<div class="section clearing">
					<div class="column div_1_of_1">
						<form action="" method="post" enctype="multipart/form-data">
							<div class="section clearing">
								<div class="column div_1_of_1">
		            				<input type="file" name="file">
		            			</div>
		            		</div>
		            		<div class="section clearing">
								<div class="column div_1_of_1">
		            				<input type="submit" name="submit">
		            			</div>
		            		</div>	
		           			 
	      				</form>

					</div>
				</div>
				<ul>
					<li><a href="update.php">Update</a></li>
					<li><a href="changepassword.php">Change password</a></li>				
				</ul>
			</div>
		</div>     
	</div>
	<div class="column div_4_of_5">
	</div>
</div>
<?php
require_once "includes/footer.php";
?>
